package com.red.wood.module.eval.web;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.red.wood.module.eval.service.DictionaryService;

@Controller
@RequestMapping("/evalDictionary")
public class DictionaryController {

	private static final Log log = LogFactory.getLog(DictionaryController.class);
	@Autowired
	private DictionaryService dictionaryService;
	
	/**
	 * 
	 * getDictionaryByType:根据字典类型获取字典. <br/>
	 *
	 * @param type 字典类型
	 * @author wangguohong
	 * @return
	 * @since JDK 1.6
	 */
	@RequestMapping(value = "getDictionaryByType", method = RequestMethod.POST)
	@ResponseBody
	public List<Map<String, Object>> getDictionaryByType(String type){
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		try {
			if(type != null){
				list = dictionaryService.getByType(type);
			}
		} catch (Exception e) {
			log.error("获取数据失败！",e);
		}
		return list;
	}
}
